package com.goodfather.textbook.youdao.pad.bean;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Created by PVer on 2018/4/26.
 */

public class UserData implements Parcelable {

    public String id;
    public String phoneNumber;
    public String avatarUrl = "";
    public int gender;

    public String username = "";
    public String nickName = "";
    public String wxNickName;
    public String wxUnionId;


    public int point;//积分
    public String birthday;
    public String sessionToken;
    public String school;
    public boolean outClassVip;
    public String outClassVipDate;
    public Boolean isVip;
    public String vipDate;
    public String levelReadVipDate;
    public Boolean levelReadVip;
    public int grade;
    public String country;
    public String email;


    /**
     * 即将过期的优惠券的数量
     */
    public int almostPastCouponLength;
    /**
     * 未使用的优惠券数量
     */
    public int unUseCouponLength;

    /**
     * 红包余额
     */
    public double redPacket;
    /**
     * 红包余额收支笔数（当前有几笔收入）
     */
    public int redPacketInfoSize;


    //第一次用微信登录时会有以下两个字段
    public String unionId;
    public String openId;

    public String baiduerVipDate;
    public String baiduerVipDateBegin;
    public boolean baiduerVip;
    public int vipUnlockTextbookTimes;

    public int vipUnlockWarnTimes;

    public String vipUnlockWarnText;

    public String channeluserVipDate;//渠道 vip截止日期
    public String channeluserVipDateBegin;//渠道 vip开始日期
    public String channeluserUid;//华为教育中心 openId;
    public boolean channeluserVip;//是否是会员


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.id);
        dest.writeString(this.phoneNumber);
        dest.writeString(this.avatarUrl);
        dest.writeInt(this.gender);
        dest.writeString(this.username);
        dest.writeString(this.nickName);
        dest.writeString(this.wxNickName);
        dest.writeString(this.wxUnionId);
        dest.writeInt(this.point);
        dest.writeString(this.birthday);
        dest.writeString(this.sessionToken);
        dest.writeString(this.school);
        dest.writeByte(this.outClassVip ? (byte) 1 : (byte) 0);
        dest.writeString(this.outClassVipDate);
        dest.writeValue(this.isVip);
        dest.writeString(this.vipDate);
        dest.writeString(this.levelReadVipDate);
        dest.writeValue(this.levelReadVip);
        dest.writeInt(this.grade);
        dest.writeString(this.country);
        dest.writeString(this.email);
        dest.writeInt(this.almostPastCouponLength);
        dest.writeInt(this.unUseCouponLength);
        dest.writeDouble(this.redPacket);
        dest.writeInt(this.redPacketInfoSize);
        dest.writeString(this.unionId);
        dest.writeString(this.openId);
        dest.writeString(this.baiduerVipDate);
        dest.writeString(this.baiduerVipDateBegin);
        dest.writeByte(this.baiduerVip ? (byte) 1 : (byte) 0);
        dest.writeInt(this.vipUnlockTextbookTimes);
        dest.writeInt(this.vipUnlockWarnTimes);
        dest.writeString(this.vipUnlockWarnText);
        dest.writeString(this.channeluserVipDate);
        dest.writeString(this.channeluserVipDateBegin);
        dest.writeString(this.channeluserUid);
    }

    protected UserData(Parcel in) {
        this.id = in.readString();
        this.phoneNumber = in.readString();
        this.avatarUrl = in.readString();
        this.gender = in.readInt();
        this.username = in.readString();
        this.nickName = in.readString();
        this.wxNickName = in.readString();
        this.wxUnionId = in.readString();
        this.point = in.readInt();
        this.birthday = in.readString();
        this.sessionToken = in.readString();
        this.school = in.readString();
        this.outClassVip = in.readByte() != 0;
        this.outClassVipDate = in.readString();
        this.isVip = (Boolean) in.readValue(Boolean.class.getClassLoader());
        this.vipDate = in.readString();
        this.levelReadVipDate = in.readString();
        this.levelReadVip = (Boolean) in.readValue(Boolean.class.getClassLoader());
        this.grade = in.readInt();
        this.country = in.readString();
        this.email = in.readString();
        this.almostPastCouponLength = in.readInt();
        this.unUseCouponLength = in.readInt();
        this.redPacket = in.readDouble();
        this.redPacketInfoSize = in.readInt();
        this.unionId = in.readString();
        this.openId = in.readString();
        this.baiduerVipDate = in.readString();
        this.baiduerVipDateBegin = in.readString();
        this.baiduerVip = in.readByte() != 0;
        this.vipUnlockTextbookTimes = in.readInt();
        this.vipUnlockWarnTimes = in.readInt();
        this.vipUnlockWarnText = in.readString();
        this.channeluserVipDate = in.readString();
        this.channeluserVipDateBegin = in.readString();
        this.channeluserUid = in.readString();
    }

    public static final Creator<UserData> CREATOR = new Creator<UserData>() {
        @Override
        public UserData createFromParcel(Parcel source) {
            return new UserData(source);
        }

        @Override
        public UserData[] newArray(int size) {
            return new UserData[size];
        }
    };
}



